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 
48  class StdExpansion3D;
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);
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  /** \brief return the number of edges in 3D expansion
127  */
128  int GetNedges() const
129  {
130  return v_GetNedges();
131  }
132 
133  /** \brief This function returns the number of expansion coefficients
134  * belonging to the \a i-th edge
135  *
136  * This function is a wrapper around the virtual function
137  * \a v_GetEdgeNcoeffs()
138  *
139  * \param i specifies which edge
140  * \return returns the number of expansion coefficients belonging to
141  * the \a i-th edge
142  */
143  int GetEdgeNcoeffs(const int i) const
144  {
145  return v_GetEdgeNcoeffs(i);
146  }
147 
149  const int tid,
150  Array<OneD, unsigned int> &maparray,
151  Array<OneD, int> &signarray,
152  Orientation traceOrient = eForwards)
153  {
154  v_GetEdgeInteriorToElementMap(tid,maparray,signarray,traceOrient);
155  }
156 
157  protected:
158 
159  /** \brief This function evaluates the expansion at a single
160  * (arbitrary) point of the domain
161  *
162  *
163  * Based on the value of the expansion at the quadrature points,
164  * this function calculates the value of the expansion at an
165  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
166  * given by the pointer \a coords). This operation, equivalent to
167  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
168  * is evaluated using Lagrangian interpolants through the quadrature
169  * points:
170  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
171  *
172  * This function requires that the physical value array
173  * \f$\mathbf{u}\f$ (implemented as the attribute #phys)
174  * is set.
175  *
176  * \param coords the coordinates of the single point
177  * \return returns the value of the expansion at the single point
178  */
180  const Array<OneD, const NekDouble>& coords,
181  const Array<OneD, const NekDouble>& physvals);
182 
183 
186  const Array<OneD, const NekDouble >& physvals);
187 
189  const Array<OneD, const NekDouble>& base0,
190  const Array<OneD, const NekDouble>& base1,
191  const Array<OneD, const NekDouble>& base2,
192  const Array<OneD, const NekDouble>& inarray,
193  Array<OneD, NekDouble>& outarray,
195  bool doCheckCollDir0,
196  bool doCheckCollDir1,
197  bool doCheckCollDir2) = 0;
198 
200  const Array<OneD, const NekDouble>& base0,
201  const Array<OneD, const NekDouble>& base1,
202  const Array<OneD, const NekDouble>& base2,
203  const Array<OneD, const NekDouble>& inarray,
204  Array<OneD, NekDouble>& outarray,
206  bool doCheckCollDir0,
207  bool doCheckCollDir1,
208  bool doCheckCollDir2) = 0;
209 
211  const Array<OneD, const NekDouble> &inarray,
212  Array<OneD,NekDouble> &outarray,
213  const StdRegions::StdMatrixKey &mkey);
214 
216  const Array<OneD, const NekDouble> &inarray,
217  Array<OneD,NekDouble> &outarray,
218  const StdRegions::StdMatrixKey &mkey);
219 
221  const Array<OneD, const NekDouble>& inarray);
222 
223  STD_REGIONS_EXPORT virtual int v_GetNedges(void) const;
224  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
225 
227  const int tid,
228  Array<OneD, unsigned int> &maparray,
229  Array<OneD, int> &signarray,
230  Orientation traceOrient = eForwards);
231 
233  const int dir,
234  DNekMatSharedPtr &mat);
235 
236  private:
237 
238  virtual int v_GetShapeDimension() const
239  {
240  return 3;
241  }
242 
243  virtual int v_GetCoordim(void)
244  {
245  return 3;
246  }
247  };
248 
250  const int facedir,
251  const LibUtilities::BasisType faceDirBasisType,
252  const int numpoints,
253  const int nummodes);
254 
256  const int facedir,
257  const LibUtilities::BasisType faceDirBasisType,
258  const int numpoints,
259  const int nummodes);
260  } //end of namespace
261 } //end of namespace
262 
263 #endif //STDEXP3D_H
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
Integrates the specified function over the domain.
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
virtual int v_GetNedges(void) const
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_GetEdgeInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards)
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)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
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
int GetNedges() const
return the number of edges in 3D expansion
virtual int v_GetEdgeNcoeffs(const int i) const
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.
void GetEdgeInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards)
virtual int v_GetShapeDimension() const
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
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
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.
virtual void v_GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat)
The base class for all shapes.
Definition: StdExpansion.h:63
LibUtilities::BasisKey EvaluateTriFaceBasisKey(const int facedir, const LibUtilities::BasisType faceDirBasisType, const int numpoints, const int nummodes)
LibUtilities::BasisKey EvaluateQuadFaceBasisKey(const int facedir, const LibUtilities::BasisType faceDirBasisType, const int numpoints, const int nummodes)
std::shared_ptr< StdExpansion3D > StdExpansion3DSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
double NekDouble