Nektar++
StdExpansion3D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdExpansion3D.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: Daughter of StdExpansion. This class contains routine
32 // which are common to 3D expansion. Typically this inolves physiocal
33 // space operations.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef STDEXP3D_H
38 #define STDEXP3D_H
39 
42 
43 namespace Nektar
44 {
45  namespace StdRegions
46  {
47 
49  typedef std::shared_ptr<StdExpansion3D> StdExpansion3DSharedPtr;
50 
51  class StdExpansion3D: virtual public StdExpansion
52  {
53 
54  public:
57  const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc);
58  STD_REGIONS_EXPORT StdExpansion3D(const StdExpansion3D &T);
60 
61  // Differentiation
62 
63  /** \brief Calculate the 3D derivative in the local
64  * tensor/collapsed coordinate at the physical points
65  *
66  * This function is independent of the expansion basis and can
67  * therefore be defined for all tensor product distribution of
68  * quadrature points in a generic manner. The key operations are:
69  *
70  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
71  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
72  * - \f$ \frac{d}{d\eta_3} \rightarrow {\bf D_2 u } \f$
73  *
74  * \param inarray array of physical points to be differentiated
75  * \param outarray_d1 the resulting array of derivative in the
76  * \f$\eta_1\f$ direction will be stored in outarray_d1 as output
77  * of the function
78  * \param outarray_d2 the resulting array of derivative in the
79  * \f$\eta_2\f$ direction will be stored in outarray_d2 as output
80  * of the function
81  * \param outarray_d3 the resulting array of derivative in the
82  * \f$\eta_3\f$ direction will be stored in outarray_d3 as output
83  * of the function
84  *
85  * Recall that:
86  * \f$
87  * \hspace{1cm} \begin{array}{llll}
88  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
89  * \mbox{Collapsed coord.} &
90  * \mbox{Collapsed coordinate definition}\\
91  * \mbox{Hexahedral} & -1 \leq \xi_1,\xi_2, \xi_3 \leq 1
92  * & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
93  * & \eta_1 = \xi_1, \eta_2 = \xi_2, \eta_3 = \xi_3 \\
94  * \mbox{Tetrahedral} & -1 \leq \xi_1,\xi_2,\xi_3; \xi_1+\xi_2 +\xi_3 \leq -1
95  * & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
96  * & \eta_1 = \frac{2(1+\xi_1)}{-\xi_2 -\xi_3}-1, \eta_2 = \frac{2(1+\xi_2)}{1 - \xi_3}-1, \eta_3 = \xi_3 \\
97  * \end{array} \f$
98  */
100  Array<OneD, NekDouble> &outarray_d1,
101  Array<OneD, NekDouble> &outarray_d2,
102  Array<OneD, NekDouble> &outarray_d3);
103 
105  const Array<OneD, const NekDouble>& base0,
106  const Array<OneD, const NekDouble>& base1,
107  const Array<OneD, const NekDouble>& base2,
108  const Array<OneD, const NekDouble>& inarray,
109  Array<OneD, NekDouble>& outarray,
111  bool doCheckCollDir0,
112  bool doCheckCollDir1,
113  bool doCheckCollDir2);
114 
116  const Array<OneD, const NekDouble>& base0,
117  const Array<OneD, const NekDouble>& base1,
118  const Array<OneD, const NekDouble>& base2,
119  const Array<OneD, const NekDouble>& inarray,
120  Array<OneD, NekDouble> &outarray,
122  bool doCheckCollDir0,
123  bool doCheckCollDir1,
124  bool doCheckCollDir2);
125 
126  protected:
127 
128  /** \brief This function evaluates the expansion at a single
129  * (arbitrary) point of the domain
130  *
131  *
132  * Based on the value of the expansion at the quadrature points,
133  * this function calculates the value of the expansion at an
134  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
135  * given by the pointer \a coords). This operation, equivalent to
136  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
137  * is evaluated using Lagrangian interpolants through the quadrature
138  * points:
139  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
140  *
141  * This function requires that the physical value array
142  * \f$\mathbf{u}\f$ (implemented as the attribute #phys)
143  * is set.
144  *
145  * \param coords the coordinates of the single point
146  * \return returns the value of the expansion at the single point
147  */
149  const Array<OneD, const NekDouble>& coords,
150  const Array<OneD, const NekDouble>& physvals);
151 
152 
155  const Array<OneD, const NekDouble >& physvals);
156 
158  const Array<OneD, const NekDouble>& base0,
159  const Array<OneD, const NekDouble>& base1,
160  const Array<OneD, const NekDouble>& base2,
161  const Array<OneD, const NekDouble>& inarray,
162  Array<OneD, NekDouble>& outarray,
164  bool doCheckCollDir0,
165  bool doCheckCollDir1,
166  bool doCheckCollDir2) = 0;
167 
169  const Array<OneD, const NekDouble>& base0,
170  const Array<OneD, const NekDouble>& base1,
171  const Array<OneD, const NekDouble>& base2,
172  const Array<OneD, const NekDouble>& inarray,
173  Array<OneD, NekDouble>& outarray,
175  bool doCheckCollDir0,
176  bool doCheckCollDir1,
177  bool doCheckCollDir2) = 0;
178 
180  const Array<OneD, const NekDouble> &inarray,
181  Array<OneD,NekDouble> &outarray,
182  const StdRegions::StdMatrixKey &mkey);
183 
185  const Array<OneD, const NekDouble> &inarray,
186  Array<OneD,NekDouble> &outarray,
187  const StdRegions::StdMatrixKey &mkey);
188 
190  const Array<OneD, const NekDouble>& inarray);
191 
193  const int face);
194 
196  const int face);
197 
198  STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const
199  {
200  return GetFaceNcoeffs(i);
201  }
202 
203  std::map<int, NormalVector> m_faceNormals;
204  std::map<int, bool> m_negatedNormals;
205 
206  private:
207 
208  virtual int v_GetShapeDimension() const
209  {
210  return 3;
211  }
212 
213  virtual int v_GetCoordim(void)
214  {
215  return 3;
216  }
217  STD_REGIONS_EXPORT const NormalVector & v_GetSurfaceNormal(const int id) const;
218  STD_REGIONS_EXPORT const NormalVector & v_GetFaceNormal(const int face) const;
219 
220  };
221 
223  const int facedir,
224  const LibUtilities::BasisType faceDirBasisType,
225  const int numpoints,
226  const int nummodes);
227 
229  const int facedir,
230  const LibUtilities::BasisType faceDirBasisType,
231  const int numpoints,
232  const int nummodes);
233  } //end of namespace
234 } //end of namespace
235 
236 #endif //STDEXP3D_H
void BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
const NormalVector & v_GetFaceNormal(const int face) const
LibUtilities::BasisKey EvaluateTriFaceBasisKey(const int facedir, const LibUtilities::BasisType faceDirBasisType, const int numpoints, const int nummodes)
virtual bool v_FaceNormalNegated(const int face)
virtual void v_BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0
const NormalVector & v_GetSurfaceNormal(const int id) const
virtual int v_GetShapeDimension() const
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:353
std::map< int, bool > m_negatedNormals
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d1, Array< OneD, NekDouble > &outarray_d2, Array< OneD, NekDouble > &outarray_d3)
Calculate the 3D derivative in the local tensor/collapsed coordinate at the physical points...
The base class for all shapes.
Definition: StdExpansion.h:68
void IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
std::shared_ptr< StdExpansion3D > StdExpansion3DSharedPtr
LibUtilities::BasisKey EvaluateQuadFaceBasisKey(const int facedir, const LibUtilities::BasisType faceDirBasisType, const int numpoints, const int nummodes)
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
Integrates the specified function over the domain.
double NekDouble
virtual int v_GetTraceNcoeffs(const int i) const
std::map< int, NormalVector > m_faceNormals
#define STD_REGIONS_EXPORT
virtual void v_NegateFaceNormal(const int face)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
This function evaluates the expansion at a single (arbitrary) point of the domain.
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Describes the specification for a Basis.
Definition: Basis.h:49
virtual void v_IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0