Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 int npts, const Array<OneD, const NekDouble> &inarray,
100  Array<OneD, NekDouble> &outarray, bool IsForwards, bool Shuff = true,
101  bool UnShuff = true);
102 
104  {
105  return m_homogeneousBasis;
106  }
107 
109  const Array<OneD, const NekDouble> &inarray,
111  Array<OneD, NekDouble> &out_d2);
112 
114  Direction edir, const Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &out_d);
116 
118  {
119  return m_planes[n];
120  }
121 
124 
125 protected:
126  /// FFT variables
127  bool m_useFFT;
129 
131 
134 
135  /// Definition of the total number of degrees of freedom and
136  /// quadrature points. Sets up the storage for \a m_coeff and \a
137  /// m_phys.
139  NekDouble m_lhom; ///< Width of homogeneous direction
142 
144  Homogeneous1DMatType mattype) const;
145 
147  Homogeneous1DMatType mattype) const;
148 
150  {
151  NekDouble returnval = 0.0;
152 
153  if (m_specVanVisc.size())
154  {
155  returnval = m_specVanVisc[k];
156  }
157 
158  return returnval;
159  }
160 
161  // virtual functions
162  virtual void v_SetHomo1DSpecVanVisc(Array<OneD, NekDouble> visc) override
163  {
164  m_specVanVisc = visc;
165  }
166 
167  virtual size_t v_GetNumElmts(void) override
168  {
169  return m_planes[0]->GetExpSize();
170  }
171 
173  {
174  return GetHomogeneousBasis();
175  }
176 
177  virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
178  Array<OneD, NekDouble> &outarray) override;
179 
180  virtual void v_FwdTransLocalElmt(
181  const Array<OneD, const NekDouble> &inarray,
182  Array<OneD, NekDouble> &outarray) override;
183 
184  virtual void v_FwdTransBndConstrained(
185  const Array<OneD, const NekDouble> &inarray,
186  Array<OneD, NekDouble> &outarray) override;
187 
188  virtual void v_BwdTrans(const Array<OneD, const NekDouble> &inarray,
189  Array<OneD, NekDouble> &outarray) override;
190 
191  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray) override;
193 
194  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr>
195  v_GetFieldDefinitions(void) override;
196 
197  virtual void v_GetFieldDefinitions(
198  std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
199  override;
200 
201  virtual void v_AppendFieldData(
203  std::vector<NekDouble> &fielddata) override;
204 
205  virtual void v_AppendFieldData(
207  std::vector<NekDouble> &fielddata,
208  Array<OneD, NekDouble> &coeffs) override;
209 
210  virtual void v_ExtractDataToCoeffs(
212  std::vector<NekDouble> &fielddata, std::string &field,
213  Array<OneD, NekDouble> &coeffs,
214  std::unordered_map<int, int> zIdToPlane) override;
215 
216  virtual void v_ExtractCoeffsToCoeffs(
217  const std::shared_ptr<ExpList> &fromExpList,
218  const Array<OneD, const NekDouble> &fromCoeffs,
219  Array<OneD, NekDouble> &toCoeffs) override;
220 
221  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
222  std::string var) override;
223 
224  virtual void v_PhysInterp1DScaled(
225  const NekDouble scale, const Array<OneD, NekDouble> &inarray,
226  Array<OneD, NekDouble> &outarray) override;
227 
229  const NekDouble scale, const Array<OneD, NekDouble> &inarray,
230  Array<OneD, NekDouble> &outarray) override;
231 
232  virtual void v_HomogeneousFwdTrans(
233  const int npts, const Array<OneD, const NekDouble> &inarray,
234  Array<OneD, NekDouble> &outarray, bool Shuff = true,
235  bool UnShuff = true) override;
236 
237  virtual void v_HomogeneousBwdTrans(
238  const int npts, const Array<OneD, const NekDouble> &inarray,
239  Array<OneD, NekDouble> &outarray, bool Shuff = true,
240  bool UnShuff = true) override;
241 
242  virtual void v_DealiasedProd(const int num_dofs,
243  const Array<OneD, NekDouble> &inarray1,
244  const Array<OneD, NekDouble> &inarray2,
245  Array<OneD, NekDouble> &outarray) override;
246 
247  virtual void v_DealiasedDotProd(
248  const int num_dofs, const Array<OneD, Array<OneD, NekDouble>> &inarray1,
249  const Array<OneD, Array<OneD, NekDouble>> &inarray2,
250  Array<OneD, Array<OneD, NekDouble>> &outarray) override;
251 
252  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
253  Array<OneD, NekDouble> &out_d0,
254  Array<OneD, NekDouble> &out_d1,
255  Array<OneD, NekDouble> &out_d2) override;
256 
257  virtual void v_PhysDeriv(Direction edir,
258  const Array<OneD, const NekDouble> &inarray,
259  Array<OneD, NekDouble> &out_d) override;
260 
262  void) override;
263 
264  virtual Array<OneD, const unsigned int> v_GetZIDs(void) override;
265 
266  virtual ExpListSharedPtr &v_GetPlane(int n) override
267  {
268  return GetPlane(n);
269  }
270 
271  virtual NekDouble v_GetHomoLen(void) override;
272 
273  virtual void v_SetHomoLen(const NekDouble lhom) override;
274 
275  virtual NekDouble v_Integral(
276  const Array<OneD, const NekDouble> &inarray) override;
277 
278 private:
279  // Padding operations variables
282 
283  /// Spectral vanishing Viscosity coefficient for stabilisation
285 };
286 
287 } // namespace MultiRegions
288 } // namespace Nektar
289 
290 #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 std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void) override
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void) override
NekDouble m_lhom
Width of homogeneous direction.
LibUtilities::TranspositionSharedPtr m_transposition
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs, std::unordered_map< int, int > zIdToPlane) override
Extract data from raw field data into expansion list.
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var) override
Array< OneD, NekDouble > m_specVanVisc
Spectral vanishing Viscosity coefficient for stabilisation.
virtual void v_FwdTransLocalElmt(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Array< OneD, ExpListSharedPtr > m_planes
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata) override
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::NektarFFTSharedPtr m_FFT_deal
virtual void v_HomogeneousFwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
virtual void v_ExtractCoeffsToCoeffs(const std::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs) override
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
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) override
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::NektarFFTSharedPtr m_FFT
virtual ExpListSharedPtr & v_GetPlane(int n) override
virtual NekDouble v_GetHomoLen(void) override
void Homogeneous1DTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, bool Shuff=true, bool UnShuff=true)
virtual void v_HomogeneousBwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
virtual void v_SetHomoLen(const NekDouble lhom) override
virtual LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void) override
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
virtual Array< OneD, const unsigned int > v_GetZIDs(void) override
virtual void v_DealiasedProd(const int num_dofs, const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray) override
virtual void v_SetHomo1DSpecVanVisc(Array< OneD, NekDouble > visc) override
LibUtilities::BasisSharedPtr GetHomogeneousBasis(void)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
ExpListHomogeneous1D(const ExpansionType type)
Default constructor.
virtual void v_DealiasedDotProd(const int num_dofs, const Array< OneD, Array< OneD, NekDouble >> &inarray1, const Array< OneD, Array< OneD, NekDouble >> &inarray2, Array< OneD, Array< OneD, NekDouble >> &outarray) override
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:103
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:186
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:2
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
double NekDouble