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:
56  STD_REGIONS_EXPORT StdExpansion3D(int numcoeffs,
57  const LibUtilities::BasisKey &Ba,
58  const LibUtilities::BasisKey &Bb,
59  const LibUtilities::BasisKey &Bc);
62 
63  // Differentiation
64 
65  /** \brief Calculate the 3D derivative in the local
66  * tensor/collapsed coordinate at the physical points
67  *
68  * This function is independent of the expansion basis and can
69  * therefore be defined for all tensor product distribution of
70  * quadrature points in a generic manner. The key operations are:
71  *
72  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
73  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
74  * - \f$ \frac{d}{d\eta_3} \rightarrow {\bf D_2 u } \f$
75  *
76  * \param inarray array of physical points to be differentiated
77  * \param outarray_d1 the resulting array of derivative in the
78  * \f$\eta_1\f$ direction will be stored in outarray_d1 as output
79  * of the function
80  * \param outarray_d2 the resulting array of derivative in the
81  * \f$\eta_2\f$ direction will be stored in outarray_d2 as output
82  * of the function
83  * \param outarray_d3 the resulting array of derivative in the
84  * \f$\eta_3\f$ direction will be stored in outarray_d3 as output
85  * of the function
86  *
87  * Recall that:
88  * \f$
89  * \hspace{1cm} \begin{array}{llll}
90  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
91  * \mbox{Collapsed coord.} &
92  * \mbox{Collapsed coordinate definition}\\
93  * \mbox{Hexahedral} & -1 \leq \xi_1,\xi_2, \xi_3 \leq 1
94  * & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
95  * & \eta_1 = \xi_1, \eta_2 = \xi_2, \eta_3 = \xi_3 \\
96  * \mbox{Tetrahedral} & -1 \leq \xi_1,\xi_2,\xi_3; \xi_1+\xi_2 +\xi_3 \leq
97  * -1 & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
98  * & \eta_1 = \frac{2(1+\xi_1)}{-\xi_2 -\xi_3}-1, \eta_2 =
99  * \frac{2(1+\xi_2)}{1 - \xi_3}-1, \eta_3 = \xi_3 \\ \end{array} \f$
100  */
102  const Array<OneD, const NekDouble> &inarray,
103  Array<OneD, NekDouble> &outarray_d1,
104  Array<OneD, NekDouble> &outarray_d2,
105  Array<OneD, NekDouble> &outarray_d3);
106 
108  const Array<OneD, const NekDouble> &base0,
109  const Array<OneD, const NekDouble> &base1,
110  const Array<OneD, const NekDouble> &base2,
111  const Array<OneD, const NekDouble> &inarray,
113  bool doCheckCollDir0, bool doCheckCollDir1, 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,
121  bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2);
122 
123  /** \brief return the number of edges in 3D expansion
124  */
125  int GetNedges() const
126  {
127  return v_GetNedges();
128  }
129 
130  /** \brief This function returns the number of expansion coefficients
131  * belonging to the \a i-th edge
132  *
133  * This function is a wrapper around the virtual function
134  * \a v_GetEdgeNcoeffs()
135  *
136  * \param i specifies which edge
137  * \return returns the number of expansion coefficients belonging to
138  * the \a i-th edge
139  */
140  int GetEdgeNcoeffs(const int i) const
141  {
142  return v_GetEdgeNcoeffs(i);
143  }
144 
145  void GetEdgeInteriorToElementMap(const int tid,
146  Array<OneD, unsigned int> &maparray,
147  Array<OneD, int> &signarray,
148  Orientation traceOrient = eForwards)
149  {
150  v_GetEdgeInteriorToElementMap(tid, maparray, signarray, traceOrient);
151  }
152 
153 protected:
154  /** \brief This function evaluates the expansion at a single
155  * (arbitrary) point of the domain
156  *
157  *
158  * Based on the value of the expansion at the quadrature points,
159  * this function calculates the value of the expansion at an
160  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
161  * given by the pointer \a coords). This operation, equivalent to
162  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
163  * is evaluated using Lagrangian interpolants through the quadrature
164  * points:
165  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
166  *
167  * This function requires that the physical value array
168  * \f$\mathbf{u}\f$ (implemented as the attribute #phys)
169  * is set.
170  *
171  * \param coords the coordinates of the single point
172  * \return returns the value of the expansion at the single point
173  */
175  const Array<OneD, const NekDouble> &coords,
176  const Array<OneD, const NekDouble> &physvals);
177 
180  const Array<OneD, const NekDouble> &physvals);
181 
183  const Array<OneD, const NekDouble> &base0,
184  const Array<OneD, const NekDouble> &base1,
185  const Array<OneD, const NekDouble> &base2,
186  const Array<OneD, const NekDouble> &inarray,
188  bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2) = 0;
189 
191  const Array<OneD, const NekDouble> &base0,
192  const Array<OneD, const NekDouble> &base1,
193  const Array<OneD, const NekDouble> &base2,
194  const Array<OneD, const NekDouble> &inarray,
196  bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2) = 0;
197 
199  const Array<OneD, const NekDouble> &inarray,
200  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey);
201 
203  const Array<OneD, const NekDouble> &inarray,
204  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey);
205 
207  const Array<OneD, const NekDouble> &inarray);
208 
209  STD_REGIONS_EXPORT virtual int v_GetNedges(void) const;
210  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
211 
213  const int tid, Array<OneD, unsigned int> &maparray,
214  Array<OneD, int> &signarray, Orientation traceOrient = eForwards);
215 
217  const int tid, Array<OneD, unsigned int> &maparray,
218  Array<OneD, int> &signarray, Orientation traceOrient, int P, int Q);
219 
220  STD_REGIONS_EXPORT virtual void v_GenStdMatBwdDeriv(const int dir,
221  DNekMatSharedPtr &mat);
222 
223 private:
224  virtual int v_GetShapeDimension() const
225  {
226  return 3;
227  }
228 
229  virtual int v_GetCoordim(void)
230  {
231  return 3;
232  }
233 };
234 
236  const int facedir, const LibUtilities::BasisType faceDirBasisType,
237  const int numpoints, const int nummodes);
238 
240  const int facedir, const LibUtilities::BasisType faceDirBasisType,
241  const int numpoints, const int nummodes);
242 } // namespace StdRegions
243 } // namespace Nektar
244 
245 #endif // STDEXP3D_H
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
virtual void v_GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient, int P, int Q)
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:71
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:75
double NekDouble