Nektar++
StdExpansion2D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdExpansion2D.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 2D expansion. Typically this inolves physiocal
33 // space operations.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef STDEXP2D_H
38 #define STDEXP2D_H
39 
42 
43 namespace Nektar
44 {
45 namespace StdRegions
46 {
47 
48  class StdExpansion2D: virtual public StdExpansion
49  {
50  public:
53  const LibUtilities::BasisKey &Bb);
54  STD_REGIONS_EXPORT StdExpansion2D(const StdExpansion2D &T);
56 
57  // Generic operations in different element
58 
59  /** \brief Calculate the 2D derivative in the local
60  * tensor/collapsed coordinate at the physical points
61  *
62  * This function is independent of the expansion basis and can
63  * therefore be defined for all tensor product distribution of
64  * quadrature points in a generic manner. The key operations are:
65  *
66  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
67  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
68  *
69  * \param inarray array of physical points to be differentiated
70  * \param outarray_d0 the resulting array of derivative in the
71  * \f$\eta_1\f$ direction will be stored in outarray_d0 as output
72  * of the function
73  * \param outarray_d1 the resulting array of derivative in the
74  * \f$\eta_2\f$ direction will be stored in outarray_d1 as output
75  * of the function
76  *
77  * Recall that:
78  * \f$
79  * \hspace{1cm} \begin{array}{llll}
80  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
81  * \mbox{Collapsed coord.} &
82  * \mbox{Collapsed coordinate definition}\\
83  * \mbox{Quadrilateral} & -1 \leq \xi_1,\xi_2 \leq 1
84  * & -1 \leq \eta_1,\eta_2 \leq 1
85  * & \eta_1 = \xi_1, \eta_2 = \xi_2\\
86  * \mbox{Triangle} & -1 \leq \xi_1,\xi_2; \xi_1+\xi_2 \leq 0
87  * & -1 \leq \eta_1,\eta_2 \leq 1
88  * & \eta_1 = \frac{2(1+\xi_1)}{(1-\xi_2)}-1, \eta_2 = \xi_2 \\
89  * \end{array} \f$
90  */
92  const Array<OneD, const NekDouble>& inarray,
93  Array<OneD, NekDouble> &outarray_d0,
94  Array<OneD, NekDouble> &outarray_d1);
95 
97  const Array<OneD, const NekDouble>& inarray,
100 
102  const Array<OneD, const NekDouble>& base0,
103  const Array<OneD, const NekDouble>& base1,
104  const Array<OneD, const NekDouble>& inarray,
105  Array<OneD, NekDouble> &outarray,
107  bool doCheckCollDir0 = true,
108  bool doCheckCollDir1 = true);
109 
111  const Array<OneD, const NekDouble>& base0,
112  const Array<OneD, const NekDouble>& base1,
113  const Array<OneD, const NekDouble>& inarray,
114  Array<OneD, NekDouble> &outarray,
116  bool doCheckCollDir0 = true,
117  bool doCheckCollDir1 = true);
118 
119  protected:
120 
121  /** \brief This function evaluates the expansion at a single
122  * (arbitrary) point of the domain
123  *
124  * This function is a wrapper around the virtual function
125  * \a v_PhysEvaluate()
126  *
127  * Based on the value of the expansion at the quadrature points,
128  * this function calculates the value of the expansion at an
129  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
130  * given by the pointer \a coords). This operation, equivalent to
131  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
132  * is evaluated using Lagrangian interpolants through the quadrature
133  * points:
134  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
135  *
136  * This function requires that the physical value array
137  * \f$\mathbf{u}\f$ (implemented as the attribute #m_phys)
138  * is set.
139  *
140  * \param coords the coordinates of the single point
141  * \return returns the value of the expansion at the single point
142  */
144  const Array<OneD, const NekDouble>& coords,
145  const Array<OneD, const NekDouble>& physvals);
146 
149  const Array<OneD, const NekDouble> & physvals);
150 
152  const Array<OneD, const NekDouble>& base0,
153  const Array<OneD, const NekDouble>& base1,
154  const Array<OneD, const NekDouble>& inarray,
155  Array<OneD, NekDouble> &outarray,
157  bool doCheckCollDir0,
158  bool doCheckCollDir1) = 0;
159 
161  const Array<OneD, const NekDouble>& base0,
162  const Array<OneD, const NekDouble>& base1,
163  const Array<OneD, const NekDouble>& inarray,
164  Array<OneD, NekDouble> &outarray,
166  bool doCheckCollDir0,
167  bool doCheckCollDir1) = 0;
168 
170  const Array<OneD, const NekDouble> &inarray,
171  Array<OneD, NekDouble> &outarray,
172  const StdRegions::StdMatrixKey &mkey);
174  const Array<OneD, const NekDouble> &inarray,
175  Array<OneD, NekDouble> &outarray,
176  const StdRegions::StdMatrixKey &mkey);
177 
178  STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const
179  {
180  return GetEdgeNcoeffs(i);
181  }
182 
183  private:
184 
185  // Virtual Functions ----------------------------------------
186  virtual int v_GetShapeDimension() const
187  {
188  return 2;
189  }
190 
191  virtual int v_GetNfaces() const
192  {
193  return 0;
194  }
195 
196  virtual int v_GetCoordim(void)
197  {
198  return 2;
199  }
200  };
201 
202  typedef std::shared_ptr<StdExpansion2D> StdExpansion2DSharedPtr;
203 
204 } //end of namespace
205 } //end of namespace
206 
207 #endif //STDEXP2D_H
void BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0=true, bool doCheckCollDir1=true)
virtual void v_IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1)=0
NekDouble Integral(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &w0, const Array< OneD, const NekDouble > &w1)
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
std::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d0, Array< OneD, NekDouble > &outarray_d1)
Calculate the 2D derivative in the local tensor/collapsed coordinate at the physical points...
The base class for all shapes.
Definition: StdExpansion.h:68
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:286
virtual int v_GetShapeDimension() 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.
double NekDouble
virtual int v_GetTraceNcoeffs(const int i) const
#define STD_REGIONS_EXPORT
void IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0=true, bool doCheckCollDir1=true)
Describes the specification for a Basis.
Definition: Basis.h:49
virtual void v_BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1)=0
virtual void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)