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 
80  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const LibUtilities::SessionReaderSharedPtr &pSession,const LibUtilities::BasisKey &HomoBasis, const NekDouble lz, const bool useFFT, const bool dealiasing);
81 
82  /// Copy constructor.
83  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const ExpListHomogeneous1D &In);
84 
85  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const ExpListHomogeneous1D &In,
86  const std::vector<unsigned int> &eIDs);
87 
88  /// Destructor.
90 
92  Array<OneD, NekDouble> &outarray,
93  bool IsForwards,
94 
95  CoeffState coeffstate = eLocal,
96  bool Shuff = true,
97  bool UnShuff = true);
98 
99  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
100  Array<OneD, NekDouble> &outarray,
101 
102  CoeffState coeffstate = eLocal,
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  CoeffState coeffstate = eLocal,
109  bool Shuff = true,
110  bool UnShuff = true);
111 
113  {
114  return m_homogeneousBasis;
115  }
116 
118  Array<OneD, NekDouble> &out_d0,
119  Array<OneD, NekDouble> &out_d1,
120  Array<OneD, NekDouble> &out_d2);
121 
123  const Array<OneD, const NekDouble> &inarray,
124  Array<OneD, NekDouble> &out_d);
125 
127  {
128  return m_planes[n];
129  }
130 
133  protected:
134 
135  /// FFT variables
136  bool m_useFFT;
138 
140 
143 
144  /// Definition of the total number of degrees of freedom and
145  /// quadrature points. Sets up the storage for \a m_coeff and \a
146  /// m_phys.
148  NekDouble m_lhom; ///< Width of homogeneous direction
149  Homo1DBlockMatrixMapShPtr m_homogeneous1DBlockMat;
151 
152  std::unordered_map<int, int> m_zIdToPlane;
153 
155 
157 
158 
160  {
161  NekDouble returnval = 0.0;
162 
163  if(m_specVanVisc.num_elements())
164  {
165  returnval = m_specVanVisc[k];
166  }
167 
168  return returnval;
169  }
170 
171  // virtual functions
173  {
174  m_specVanVisc = visc;
175  }
176 
177  virtual int v_GetNumElmts(void)
178  {
179  return m_planes[0]->GetExpSize();
180  }
181 
183  {
184  return GetHomogeneousBasis();
185  }
186 
187  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
188  Array<OneD, NekDouble> &outarray,
189  CoeffState coeffstate);
190 
191  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray);
193 
194  virtual void v_FwdTrans_BndConstrained(const Array<OneD,const NekDouble> &inarray,
195  Array<OneD, NekDouble> &outarray);
196 
197  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
198  Array<OneD, NekDouble> &outarray,
199  CoeffState coeffstate);
200 
201  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
202  Array<OneD, NekDouble> &outarray);
203 
204  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
205  Array<OneD, NekDouble> &outarray,
206  CoeffState coeffstate);
207 
208  virtual void v_IProductWRTBase_IterPerExp(const Array<OneD, const NekDouble> &inarray,
209  Array<OneD, NekDouble> &outarray);
210 
211  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
212 
213  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
214 
215  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
216 
217  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
218 
219  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
220 
221  virtual void v_ExtractCoeffsToCoeffs(
222  const std::shared_ptr<ExpList> &fromExpList, const Array<OneD, const NekDouble> &fromCoeffs, Array<OneD, NekDouble> &toCoeffs);
223 
224  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
225  std::string var);
226 
227  virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
228 
229  virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
230 
231 
232  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
233  Array<OneD, NekDouble> &outarray,
234  CoeffState coeffstate = eLocal,
235  bool Shuff = true,
236  bool UnShuff = true);
237 
238  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
239  Array<OneD, NekDouble> &outarray,
240  CoeffState coeffstate = eLocal,
241  bool Shuff = true,
242  bool UnShuff = true);
243 
244  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
245  const Array<OneD, NekDouble> &inarray2,
246  Array<OneD, NekDouble> &outarray,
247  CoeffState coeffstate = eLocal);
248 
249  virtual void v_DealiasedDotProd(
250  const Array<OneD, Array<OneD, NekDouble> > &inarray1,
251  const Array<OneD, Array<OneD, NekDouble> > &inarray2,
252  Array<OneD, Array<OneD, NekDouble> > &outarray,
253  CoeffState coeffstate = eLocal);
254 
255  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
256  Array<OneD, NekDouble> &out_d0,
257  Array<OneD, NekDouble> &out_d1,
258  Array<OneD, NekDouble> &out_d2);
259 
260  virtual void v_PhysDeriv(Direction edir,
261  const Array<OneD, const NekDouble> &inarray,
262  Array<OneD, NekDouble> &out_d);
263 
265 
267 
268  virtual ExpListSharedPtr &v_GetPlane(int n)
269  {
270  return GetPlane(n);
271  }
272 
273  virtual NekDouble v_GetHomoLen(void);
274 
275  virtual void v_SetHomoLen(const NekDouble lhom);
276 
277  private:
278 
279  //Padding operations variables
282 
283  /// Spectral vanishing Viscosity coefficient for stabilisation
285  };
286 
288  Array<OneD, NekDouble> &outarray,
289  CoeffState coeffstate,
290  bool Shuff,
291  bool UnShuff)
292  {
293  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
294  }
295 
297  Array<OneD, NekDouble> &outarray,
298  CoeffState coeffstate,
299  bool Shuff,
300  bool UnShuff)
301  {
302  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
303  }
304 
305  } //end of namespace
306 } //end of namespace
307 
308 #endif//EXPLISTHOMO1D_H
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual ExpListSharedPtr & v_GetPlane(int n)
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Local coefficients.
virtual void v_FwdTrans_BndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
LibUtilities::TranspositionSharedPtr m_transposition
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector
Vector of pointers to ExpList3DHomogeneous1D objects.
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
LibUtilities::NektarFFTSharedPtr m_FFT_deal
#define MULTI_REGIONS_EXPORT
NekDouble m_lhom
Width of homogeneous direction.
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:71
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
std::shared_ptr< ExpListHomogeneous1D > ExpListHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
Array< OneD, NekDouble > m_specVanVisc
Spectral vanishing Viscosity coefficient for stabilisation.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:103
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_ExtractCoeffsToCoeffs(const std::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Array< OneD, ExpListSharedPtr > m_planes
double NekDouble
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual Array< OneD, const unsigned int > v_GetZIDs(void)
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray, CoeffState coeffstate=eLocal)
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.
std::unordered_map< int, int > m_zIdToPlane
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
void Homogeneous1DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:179
std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
std::shared_ptr< Transposition > TranspositionSharedPtr
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:55
LibUtilities::BasisSharedPtr GetHomogeneousBasis(void)
std::shared_ptr< Homo1DBlockMatrixMap > Homo1DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
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 void v_SetHomo1DSpecVanVisc(Array< OneD, NekDouble > visc)
Describes the specification for a Basis.
Definition: Basis.h:49
std::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void)
virtual void v_SetHomoLen(const NekDouble lhom)
LibUtilities::NektarFFTSharedPtr m_FFT