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
40 #include <MultiRegions/ExpList.h>
43 #include <vector>
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>
62 /// A shared pointer to a BlockMatrixMap.
63 typedef std::shared_ptr<Homo1DBlockMatrixMap> Homo1DBlockMatrixMapShPtr;
64 
65 // Forward declaration for typedefs
67 
68 /// Shared pointer to an ExpList3DHomogeneous1D object.
69 typedef std::shared_ptr<ExpListHomogeneous1D> ExpListHomogeneous1DSharedPtr;
70 /// Vector of pointers to ExpList3DHomogeneous1D objects.
71 typedef std::vector<ExpListHomogeneous1DSharedPtr> ExpListHomogeneous1DVector;
72 
73 /// Abstraction of a two-dimensional multi-elemental expansion which
74 /// is merely a collection of local expansions.
76 {
77 public:
78  /// Default constructor.
80 
82  const ExpansionType type,
84  const LibUtilities::BasisKey &HomoBasis, const NekDouble lz,
85  const bool useFFT, const bool dealiasing);
86 
87  /// Copy constructor.
89 
91  const ExpListHomogeneous1D &In, const std::vector<unsigned int> &eIDs,
92  const Collections::ImplementationType ImpType =
94 
95  /// Destructor.
97 
99  const Array<OneD, const NekDouble> &inarray,
100  Array<OneD, NekDouble> &outarray, bool IsForwards, bool Shuff = true,
101  bool UnShuff = true);
102 
103  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
104  Array<OneD, NekDouble> &outarray,
105  bool Shuff = true, bool UnShuff = true);
106 
107  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
108  Array<OneD, NekDouble> &outarray,
109  bool Shuff = true, bool UnShuff = true);
110 
112  {
113  return m_homogeneousBasis;
114  }
115 
117  const Array<OneD, const NekDouble> &inarray,
119  Array<OneD, NekDouble> &out_d2);
120 
122  Direction edir, const Array<OneD, const NekDouble> &inarray,
123  Array<OneD, NekDouble> &out_d);
124 
126  {
127  return m_planes[n];
128  }
129 
132 
133 protected:
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  Homogeneous1DMatType mattype) const;
155 
157  Homogeneous1DMatType mattype) const;
158 
160  {
161  NekDouble returnval = 0.0;
162 
163  if (m_specVanVisc.size())
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 
190  virtual void v_FwdTransLocalElmt(
191  const Array<OneD, const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray);
193 
194  virtual void v_FwdTransBndConstrained(
195  const Array<OneD, const NekDouble> &inarray,
196  Array<OneD, NekDouble> &outarray);
197 
198  virtual void v_BwdTrans(const Array<OneD, const NekDouble> &inarray,
199  Array<OneD, NekDouble> &outarray);
200 
201  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
202  Array<OneD, NekDouble> &outarray);
203 
204  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr>
205  v_GetFieldDefinitions(void);
206 
207  virtual void v_GetFieldDefinitions(
208  std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
209 
210  virtual void v_AppendFieldData(
212  std::vector<NekDouble> &fielddata);
213 
214  virtual void v_AppendFieldData(
216  std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
217 
218  virtual void v_ExtractDataToCoeffs(
220  std::vector<NekDouble> &fielddata, std::string &field,
221  Array<OneD, NekDouble> &coeffs);
222 
223  virtual void v_ExtractCoeffsToCoeffs(
224  const std::shared_ptr<ExpList> &fromExpList,
225  const Array<OneD, const NekDouble> &fromCoeffs,
226  Array<OneD, NekDouble> &toCoeffs);
227 
228  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
229  std::string var);
230 
231  virtual void v_PhysInterp1DScaled(const NekDouble scale,
232  const Array<OneD, NekDouble> &inarray,
233  Array<OneD, NekDouble> &outarray);
234 
236  const NekDouble scale, const Array<OneD, NekDouble> &inarray,
237  Array<OneD, NekDouble> &outarray);
238 
239  virtual void v_HomogeneousFwdTrans(
240  const Array<OneD, const NekDouble> &inarray,
241  Array<OneD, NekDouble> &outarray, bool Shuff = true,
242  bool UnShuff = true);
243 
244  virtual void v_HomogeneousBwdTrans(
245  const Array<OneD, const NekDouble> &inarray,
246  Array<OneD, NekDouble> &outarray, bool Shuff = true,
247  bool UnShuff = true);
248 
249  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
250  const Array<OneD, NekDouble> &inarray2,
251  Array<OneD, NekDouble> &outarray);
252 
253  virtual void v_DealiasedDotProd(
254  const Array<OneD, Array<OneD, NekDouble>> &inarray1,
255  const Array<OneD, Array<OneD, NekDouble>> &inarray2,
256  Array<OneD, Array<OneD, NekDouble>> &outarray);
257 
258  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
259  Array<OneD, NekDouble> &out_d0,
260  Array<OneD, NekDouble> &out_d1,
261  Array<OneD, NekDouble> &out_d2);
262 
263  virtual void v_PhysDeriv(Direction edir,
264  const Array<OneD, const NekDouble> &inarray,
265  Array<OneD, NekDouble> &out_d);
266 
268 
270 
271  virtual ExpListSharedPtr &v_GetPlane(int n)
272  {
273  return GetPlane(n);
274  }
275 
276  virtual NekDouble v_GetHomoLen(void);
277 
278  virtual void v_SetHomoLen(const NekDouble lhom);
279 
281 
282 private:
283  // Padding operations variables
286 
287  /// Spectral vanishing Viscosity coefficient for stabilisation
289 };
290 
292  const Array<OneD, const NekDouble> &inarray,
293  Array<OneD, NekDouble> &outarray, bool Shuff, bool UnShuff)
294 {
295  v_HomogeneousFwdTrans(inarray, outarray, Shuff, UnShuff);
296 }
297 
299  const Array<OneD, const NekDouble> &inarray,
300  Array<OneD, NekDouble> &outarray, bool Shuff, bool UnShuff)
301 {
302  v_HomogeneousBwdTrans(inarray, outarray, Shuff, UnShuff);
303 }
304 
305 } // namespace MultiRegions
306 } // namespace Nektar
307 
308 #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_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 void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
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_FwdTransLocalElmt(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Array< OneD, ExpListSharedPtr > m_planes
std::unordered_map< int, int > m_zIdToPlane
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble >> &inarray1, const Array< OneD, Array< OneD, NekDouble >> &inarray2, Array< OneD, Array< OneD, NekDouble >> &outarray)
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)
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_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)
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:101
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:177
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::shared_ptr< ExpListHomogeneous1D > ExpListHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector
Vector of pointers to ExpList3DHomogeneous1D objects.
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:77
double NekDouble