Nektar++
ExpListHomogeneous1D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File ExpListHomogeneous1D.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: Base class for expansions which are homogeneous in 1
32 // direction
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef EXPLISTHOMO1D_H
37 #define EXPLISTHOMO1D_H
39 #include <vector>
41 #include <MultiRegions/ExpList.h>
44 
45 namespace Nektar
46 {
47  namespace MultiRegions
48  {
49 
51  {
56  };
57 
58  /// A map between homo matrix keys and their associated block
59  /// matrices.
60  typedef std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr> Homo1DBlockMatrixMap;
61  /// A shared pointer to a BlockMatrixMap.
62  typedef std::shared_ptr<Homo1DBlockMatrixMap> Homo1DBlockMatrixMapShPtr;
63 
64  // Forward declaration for typedefs
66 
67  /// Shared pointer to an ExpList3DHomogeneous1D object.
68  typedef std::shared_ptr<ExpListHomogeneous1D> ExpListHomogeneous1DSharedPtr;
69  /// Vector of pointers to ExpList3DHomogeneous1D objects.
70  typedef std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector;
71 
72  /// Abstraction of a two-dimensional multi-elemental expansion which
73  /// is merely a collection of local expansions.
75  {
76  public:
77  /// Default constructor.
79 
82  const LibUtilities::BasisKey &HomoBasis,
83  const NekDouble lz, const bool useFFT,
84  const bool dealiasing);
85 
86  /// Copy constructor.
88 
90  const std::vector<unsigned int> &eIDs);
91 
92  /// Destructor.
94 
96  Array<OneD, NekDouble> &outarray,
97  bool IsForwards,
98  bool Shuff = true,
99  bool UnShuff = true);
100 
101  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
102  Array<OneD, NekDouble> &outarray,
103  bool Shuff = true,
104  bool UnShuff = true);
105 
106  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
107  Array<OneD, NekDouble> &outarray,
108  bool Shuff = true,
109  bool UnShuff = true);
110 
112  {
113  return m_homogeneousBasis;
114  }
115 
117  Array<OneD, NekDouble> &out_d0,
118  Array<OneD, NekDouble> &out_d1,
119  Array<OneD, NekDouble> &out_d2);
120 
122  const Array<OneD, const NekDouble> &inarray,
123  Array<OneD, NekDouble> &out_d);
124 
126  {
127  return m_planes[n];
128  }
129 
132  protected:
133 
134  /// FFT variables
135  bool m_useFFT;
137 
139 
142 
143  /// Definition of the total number of degrees of freedom and
144  /// quadrature points. Sets up the storage for \a m_coeff and \a
145  /// m_phys.
147  NekDouble m_lhom; ///< Width of homogeneous direction
150 
151  std::unordered_map<int, int> m_zIdToPlane;
152 
154 
156 
158  {
159  NekDouble returnval = 0.0;
160 
161  if(m_specVanVisc.size())
162  {
163  returnval = m_specVanVisc[k];
164  }
165 
166  return returnval;
167  }
168 
169  // virtual functions
171  {
172  m_specVanVisc = visc;
173  }
174 
175  virtual int v_GetNumElmts(void)
176  {
177  return m_planes[0]->GetExpSize();
178  }
179 
181  {
182  return GetHomogeneousBasis();
183  }
184 
185  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
186  Array<OneD, NekDouble> &outarray);
187 
188  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
189  Array<OneD, NekDouble> &outarray);
190 
191  virtual void v_FwdTrans_BndConstrained(const Array<OneD,const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray);
193 
194  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
195  Array<OneD, NekDouble> &outarray);
196 
197  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
198  Array<OneD, NekDouble> &outarray);
199 
200  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
201  Array<OneD, NekDouble> &outarray);
202 
203  virtual void v_IProductWRTBase_IterPerExp(const Array<OneD, const NekDouble> &inarray,
204  Array<OneD, NekDouble> &outarray);
205 
206  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
207 
208  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
209 
210  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
211 
212  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
213 
214  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
215 
216  virtual void v_ExtractCoeffsToCoeffs(
217  const std::shared_ptr<ExpList> &fromExpList, const Array<OneD, const NekDouble> &fromCoeffs, Array<OneD, NekDouble> &toCoeffs);
218 
219  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
220  std::string var);
221 
222  virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
223 
224  virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
225 
226 
227  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
228  Array<OneD, NekDouble> &outarray,
229  bool Shuff = true,
230  bool UnShuff = true);
231 
232  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
233  Array<OneD, NekDouble> &outarray,
234  bool Shuff = true,
235  bool UnShuff = true);
236 
237  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
238  const Array<OneD, NekDouble> &inarray2,
239  Array<OneD, NekDouble> &outarray);
240 
241  virtual void v_DealiasedDotProd(
242  const Array<OneD, Array<OneD, NekDouble> > &inarray1,
243  const Array<OneD, Array<OneD, NekDouble> > &inarray2,
244  Array<OneD, Array<OneD, NekDouble> > &outarray);
245 
246  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
247  Array<OneD, NekDouble> &out_d0,
248  Array<OneD, NekDouble> &out_d1,
249  Array<OneD, NekDouble> &out_d2);
250 
251  virtual void v_PhysDeriv(Direction edir,
252  const Array<OneD, const NekDouble> &inarray,
253  Array<OneD, NekDouble> &out_d);
254 
256 
258 
259  virtual ExpListSharedPtr &v_GetPlane(int n)
260  {
261  return GetPlane(n);
262  }
263 
264  virtual NekDouble v_GetHomoLen(void);
265 
266  virtual void v_SetHomoLen(const NekDouble lhom);
267 
269 
270  private:
271 
272  //Padding operations variables
275 
276  /// Spectral vanishing Viscosity coefficient for stabilisation
278  };
279 
281  Array<OneD, NekDouble> &outarray,
282  bool Shuff,
283  bool UnShuff)
284  {
285  v_HomogeneousFwdTrans(inarray,outarray,Shuff,UnShuff);
286  }
287 
289  Array<OneD, NekDouble> &outarray,
290  bool Shuff,
291  bool UnShuff)
292  {
293  v_HomogeneousBwdTrans(inarray,outarray,Shuff,UnShuff);
294  }
295 
296  } //end of namespace
297 } //end of namespace
298 
299 #endif//EXPLISTHOMO1D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
virtual void v_FwdTrans_BndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble m_lhom
Width of homogeneous direction.
LibUtilities::TranspositionSharedPtr m_transposition
virtual ExpListSharedPtr & v_GetPlane(int n)
virtual void v_ExtractCoeffsToCoeffs(const std::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray)
virtual LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void)
Array< OneD, NekDouble > m_specVanVisc
Spectral vanishing Viscosity coefficient for stabilisation.
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, ExpListSharedPtr > m_planes
std::unordered_map< int, int > m_zIdToPlane
NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::NektarFFTSharedPtr m_FFT_deal
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual Array< OneD, const unsigned int > v_GetZIDs(void)
void Homogeneous1DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, bool Shuff=true, bool UnShuff=true)
virtual void v_SetHomoLen(const NekDouble lhom)
LibUtilities::NektarFFTSharedPtr m_FFT
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
Extract data from raw field data into expansion list.
virtual void v_SetHomo1DSpecVanVisc(Array< OneD, NekDouble > visc)
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::BasisSharedPtr GetHomogeneousBasis(void)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void)
ExpListHomogeneous1D(const ExpansionType type)
Default constructor.
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:107
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:179
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:55
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54
std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector
Vector of pointers to ExpList3DHomogeneous1D objects.
std::shared_ptr< ExpListHomogeneous1D > ExpListHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< Homo1DBlockMatrixMap > Homo1DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:71
double NekDouble