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
45namespace Nektar
46{
47namespace MultiRegions
48{
49
51{
56};
57
58/// A map between homo matrix keys and their associated block
59/// matrices.
60typedef std::map<Homogeneous1DMatType, DNekBlkMatSharedPtr>
62/// A shared pointer to a BlockMatrixMap.
63typedef std::shared_ptr<Homo1DBlockMatrixMap> Homo1DBlockMatrixMapShPtr;
64
65// Forward declaration for typedefs
67
68/// Shared pointer to an ExpList3DHomogeneous1D object.
69typedef std::shared_ptr<ExpListHomogeneous1D> ExpListHomogeneous1DSharedPtr;
70/// Vector of pointers to ExpList3DHomogeneous1D objects.
71typedef std::vector<ExpListHomogeneous1DSharedPtr> ExpListHomogeneous1DVector;
72
73/// Abstraction of a two-dimensional multi-elemental expansion which
74/// is merely a collection of local expansions.
76{
77public:
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,
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,
116
118 {
119 return m_planes[n];
120 }
121
124
125protected:
126 /// FFT variables
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
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 void v_IProductWRTDerivBase(
195 const int dir, const Array<OneD, const NekDouble> &inarray,
196 Array<OneD, NekDouble> &outarray) override;
197
198 virtual void v_IProductWRTDerivBase(
199 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
200 Array<OneD, NekDouble> &outarray) override;
201
202 virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr>
203 v_GetFieldDefinitions(void) override;
204
205 virtual void v_GetFieldDefinitions(
206 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
207 override;
208
209 virtual void v_AppendFieldData(
211 std::vector<NekDouble> &fielddata) override;
212
213 virtual void v_AppendFieldData(
215 std::vector<NekDouble> &fielddata,
216 Array<OneD, NekDouble> &coeffs) override;
217
218 virtual void v_ExtractDataToCoeffs(
220 std::vector<NekDouble> &fielddata, std::string &field,
222 std::unordered_map<int, int> zIdToPlane) override;
223
224 virtual void v_ExtractCoeffsToCoeffs(
225 const std::shared_ptr<ExpList> &fromExpList,
226 const Array<OneD, const NekDouble> &fromCoeffs,
227 Array<OneD, NekDouble> &toCoeffs) override;
228
229 virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
230 std::string var) override;
231
232 virtual void v_PhysInterp1DScaled(
233 const NekDouble scale, const Array<OneD, NekDouble> &inarray,
234 Array<OneD, NekDouble> &outarray) override;
235
237 const NekDouble scale, const Array<OneD, NekDouble> &inarray,
238 Array<OneD, NekDouble> &outarray) override;
239
240 virtual void v_HomogeneousFwdTrans(
241 const int npts, const Array<OneD, const NekDouble> &inarray,
242 Array<OneD, NekDouble> &outarray, bool Shuff = true,
243 bool UnShuff = true) override;
244
245 virtual void v_HomogeneousBwdTrans(
246 const int npts, const Array<OneD, const NekDouble> &inarray,
247 Array<OneD, NekDouble> &outarray, bool Shuff = true,
248 bool UnShuff = true) override;
249
250 virtual void v_DealiasedProd(const int num_dofs,
251 const Array<OneD, NekDouble> &inarray1,
252 const Array<OneD, NekDouble> &inarray2,
253 Array<OneD, NekDouble> &outarray) override;
254
255 virtual void v_DealiasedDotProd(
256 const int num_dofs, const Array<OneD, Array<OneD, NekDouble>> &inarray1,
257 const Array<OneD, Array<OneD, NekDouble>> &inarray2,
258 Array<OneD, Array<OneD, NekDouble>> &outarray) override;
259
260 virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
263 Array<OneD, NekDouble> &out_d2) override;
264
265 virtual void v_PhysDeriv(Direction edir,
266 const Array<OneD, const NekDouble> &inarray,
267 Array<OneD, NekDouble> &out_d) override;
268
270 void) override;
271
272 virtual Array<OneD, const unsigned int> v_GetZIDs(void) override;
273
274 virtual ExpListSharedPtr &v_GetPlane(int n) override
275 {
276 return GetPlane(n);
277 }
278
279 virtual NekDouble v_GetHomoLen(void) override;
280
281 virtual void v_SetHomoLen(const NekDouble lhom) override;
282
283 virtual NekDouble v_Integral(
284 const Array<OneD, const NekDouble> &inarray) override;
285
286private:
287 // Padding operations variables
290
291 /// Spectral vanishing Viscosity coefficient for stabilisation
293};
294
295} // namespace MultiRegions
296} // namespace Nektar
297
298#endif // EXPLISTHOMO1D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:47
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_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
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 ExpListSharedPtr & v_GetPlane(int n) 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 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_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, 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.
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:102
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:58
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
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