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
43#include <vector>
44
46{
47
49{
54};
55
56/// A map between homo matrix keys and their associated block
57/// matrices.
58typedef std::map<Homogeneous1DMatType, DNekBlkMatSharedPtr>
60/// A shared pointer to a BlockMatrixMap.
61typedef std::shared_ptr<Homo1DBlockMatrixMap> Homo1DBlockMatrixMapShPtr;
62
63// Forward declaration for typedefs
65
66/// Shared pointer to an ExpList3DHomogeneous1D object.
67typedef std::shared_ptr<ExpListHomogeneous1D> ExpListHomogeneous1DSharedPtr;
68/// Vector of pointers to ExpList3DHomogeneous1D objects.
69typedef std::vector<ExpListHomogeneous1DSharedPtr> ExpListHomogeneous1DVector;
70
71/// Abstraction of a two-dimensional multi-elemental expansion which
72/// is merely a collection of local expansions.
74{
75public:
76 /// Default constructor.
78
80 const ExpansionType type,
82 const LibUtilities::BasisKey &HomoBasis, const NekDouble lz,
83 const bool useFFT, const bool dealiasing);
84
85 /// Copy constructor.
87
89 const ExpListHomogeneous1D &In, const std::vector<unsigned int> &eIDs,
92
93 /// Destructor.
95
97 const int npts, const Array<OneD, const NekDouble> &inarray,
98 Array<OneD, NekDouble> &outarray, bool IsForwards, bool Shuff = true,
99 bool UnShuff = true);
100
102 {
103 return m_homogeneousBasis;
104 }
105
107 const Array<OneD, const NekDouble> &inarray,
109 Array<OneD, NekDouble> &out_d2);
110
112 Direction edir, const Array<OneD, const NekDouble> &inarray,
114
116 {
117 return m_planes[n];
118 }
119
122
123protected:
124 /// FFT variables
127
129
132
133 /// Definition of the total number of degrees of freedom and
134 /// quadrature points. Sets up the storage for \a m_coeff and \a
135 /// m_phys.
137 NekDouble m_lhom; ///< Width of homogeneous direction
140
142 Homogeneous1DMatType mattype) const;
143
145 Homogeneous1DMatType mattype) const;
146
148 {
149 NekDouble returnval = 0.0;
150
151 if (m_specVanVisc.size())
152 {
153 returnval = m_specVanVisc[k];
154 }
155
156 return returnval;
157 }
158
159 // virtual functions
161 {
162 m_specVanVisc = visc;
163 }
164
165 size_t v_GetNumElmts(void) override
166 {
167 return m_planes[0]->GetExpSize();
168 }
169
171 {
172 return GetHomogeneousBasis();
173 }
174
175 void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
176 Array<OneD, NekDouble> &outarray) override;
177
179 Array<OneD, NekDouble> &outarray) override;
180
182 Array<OneD, NekDouble> &outarray) override;
183
184 void v_BwdTrans(const Array<OneD, const NekDouble> &inarray,
185 Array<OneD, NekDouble> &outarray) override;
186
188 Array<OneD, NekDouble> &outarray) override;
189
190 void v_IProductWRTDerivBase(const int dir,
191 const Array<OneD, const NekDouble> &inarray,
192 Array<OneD, NekDouble> &outarray) override;
193
195 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
196 Array<OneD, NekDouble> &outarray) override;
197
198 std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(
199 void) override;
200
202 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
203 override;
204
206 std::vector<NekDouble> &fielddata) override;
207
209 std::vector<NekDouble> &fielddata,
210 Array<OneD, NekDouble> &coeffs) override;
211
214 std::vector<NekDouble> &fielddata, std::string &field,
216 std::unordered_map<int, int> zIdToPlane) override;
217
218 void v_ExtractCoeffsToCoeffs(const std::shared_ptr<ExpList> &fromExpList,
219 const Array<OneD, const NekDouble> &fromCoeffs,
220 Array<OneD, NekDouble> &toCoeffs) override;
221
222 void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
223 std::string var) override;
224
225 void v_PhysInterp1DScaled(const NekDouble scale,
226 const Array<OneD, NekDouble> &inarray,
227 Array<OneD, NekDouble> &outarray) override;
228
230 const NekDouble scale, const Array<OneD, NekDouble> &inarray,
231 Array<OneD, NekDouble> &outarray) override;
232
233 void v_HomogeneousFwdTrans(const int npts,
234 const Array<OneD, const NekDouble> &inarray,
235 Array<OneD, NekDouble> &outarray,
236 bool Shuff = true, bool UnShuff = true) override;
237
238 void v_HomogeneousBwdTrans(const int npts,
239 const Array<OneD, const NekDouble> &inarray,
240 Array<OneD, NekDouble> &outarray,
241 bool Shuff = true, bool UnShuff = true) override;
242
243 void v_DealiasedProd(const int num_dofs,
244 const Array<OneD, NekDouble> &inarray1,
245 const Array<OneD, NekDouble> &inarray2,
246 Array<OneD, NekDouble> &outarray) override;
247
249 const int num_dofs, const Array<OneD, Array<OneD, NekDouble>> &inarray1,
250 const Array<OneD, Array<OneD, NekDouble>> &inarray2,
251 Array<OneD, Array<OneD, NekDouble>> &outarray) override;
252
253 void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
256 Array<OneD, NekDouble> &out_d2) override;
257
258 void v_PhysDeriv(Direction edir,
259 const Array<OneD, const NekDouble> &inarray,
260 Array<OneD, NekDouble> &out_d) override;
261
263
265
267 {
268 return GetPlane(n);
269 }
270
271 NekDouble v_GetHomoLen(void) override;
272
273 void v_SetHomoLen(const NekDouble lhom) override;
274
275 NekDouble v_Integral(const Array<OneD, const NekDouble> &inarray) override;
276
277private:
278 // Padding operations variables
281
282 /// Spectral vanishing Viscosity coefficient for stabilisation
284};
285
286} // namespace Nektar::MultiRegions
287
288#endif // EXPLISTHOMO1D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:45
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)
std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void) override
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::TranspositionSharedPtr v_GetTransposition(void) override
NekDouble m_lhom
Width of homogeneous direction.
LibUtilities::TranspositionSharedPtr m_transposition
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.
void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var) override
Array< OneD, NekDouble > m_specVanVisc
Spectral vanishing Viscosity coefficient for stabilisation.
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
void v_FwdTransLocalElmt(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Array< OneD, ExpListSharedPtr > m_planes
void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata) override
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...
void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void) override
void v_SetHomo1DSpecVanVisc(Array< OneD, NekDouble > visc) override
LibUtilities::NektarFFTSharedPtr m_FFT_deal
void v_HomogeneousFwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
void v_ExtractCoeffsToCoeffs(const std::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs) override
NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
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
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::NektarFFTSharedPtr m_FFT
void Homogeneous1DTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, bool Shuff=true, bool UnShuff=true)
void v_HomogeneousBwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
void v_SetHomoLen(const NekDouble lhom) override
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
ExpListSharedPtr & v_GetPlane(int n) override
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype) const
Array< OneD, const unsigned int > v_GetZIDs(void) override
void v_DealiasedProd(const int num_dofs, const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray) override
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::BasisSharedPtr GetHomogeneousBasis(void)
void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
ExpListHomogeneous1D(const ExpansionType type)
Default constructor.
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:98
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:184
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:58
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
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.
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
double NekDouble