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:
52  STD_REGIONS_EXPORT StdExpansion2D(int numcoeffs,
53  const LibUtilities::BasisKey &Ba,
54  const LibUtilities::BasisKey &Bb);
57 
58  // Generic operations in different element
59 
60  /** \brief Calculate the 2D derivative in the local
61  * tensor/collapsed coordinate at the physical points
62  *
63  * This function is independent of the expansion basis and can
64  * therefore be defined for all tensor product distribution of
65  * quadrature points in a generic manner. The key operations are:
66  *
67  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
68  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
69  *
70  * \param inarray array of physical points to be differentiated
71  * \param outarray_d0 the resulting array of derivative in the
72  * \f$\eta_1\f$ direction will be stored in outarray_d0 as output
73  * of the function
74  * \param outarray_d1 the resulting array of derivative in the
75  * \f$\eta_2\f$ direction will be stored in outarray_d1 as output
76  * of the function
77  *
78  * Recall that:
79  * \f$
80  * \hspace{1cm} \begin{array}{llll}
81  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
82  * \mbox{Collapsed coord.} &
83  * \mbox{Collapsed coordinate definition}\\
84  * \mbox{Quadrilateral} & -1 \leq \xi_1,\xi_2 \leq 1
85  * & -1 \leq \eta_1,\eta_2 \leq 1
86  * & \eta_1 = \xi_1, \eta_2 = \xi_2\\
87  * \mbox{Triangle} & -1 \leq \xi_1,\xi_2; \xi_1+\xi_2 \leq 0
88  * & -1 \leq \eta_1,\eta_2 \leq 1
89  * & \eta_1 = \frac{2(1+\xi_1)}{(1-\xi_2)}-1, \eta_2 = \xi_2 \\
90  * \end{array} \f$
91  */
93  const Array<OneD, const NekDouble> &inarray,
94  Array<OneD, NekDouble> &outarray_d0,
95  Array<OneD, NekDouble> &outarray_d1);
96 
100  const Array<OneD, const NekDouble> &w1);
101 
103  const Array<OneD, const NekDouble> &base0,
104  const Array<OneD, const NekDouble> &base1,
105  const Array<OneD, const NekDouble> &inarray,
107  bool doCheckCollDir0 = true, bool doCheckCollDir1 = true);
108 
110  const Array<OneD, const NekDouble> &base0,
111  const Array<OneD, const NekDouble> &base1,
112  const Array<OneD, const NekDouble> &inarray,
114  bool doCheckCollDir0 = true, bool doCheckCollDir1 = true);
115 
116 protected:
117  /** \brief This function evaluates the expansion at a single
118  * (arbitrary) point of the domain
119  *
120  * This function is a wrapper around the virtual function
121  * \a v_PhysEvaluate()
122  *
123  * Based on the value of the expansion at the quadrature points,
124  * this function calculates the value of the expansion at an
125  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
126  * given by the pointer \a coords). This operation, equivalent to
127  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
128  * is evaluated using Lagrangian interpolants through the quadrature
129  * points:
130  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
131  *
132  * This function requires that the physical value array
133  * \f$\mathbf{u}\f$ (implemented as the attribute #m_phys)
134  * is set.
135  *
136  * \param coords the coordinates of the single point
137  * \return returns the value of the expansion at the single point
138  */
140  const Array<OneD, const NekDouble> &coords,
141  const Array<OneD, const NekDouble> &physvals);
142 
145  const Array<OneD, const NekDouble> &physvals);
146 
148  const Array<OneD, const NekDouble> &base0,
149  const Array<OneD, const NekDouble> &base1,
150  const Array<OneD, const NekDouble> &inarray,
152  bool doCheckCollDir0, bool doCheckCollDir1) = 0;
153 
155  const Array<OneD, const NekDouble> &base0,
156  const Array<OneD, const NekDouble> &base1,
157  const Array<OneD, const NekDouble> &inarray,
159  bool doCheckCollDir0, bool doCheckCollDir1) = 0;
160 
162  const Array<OneD, const NekDouble> &inarray,
163  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey);
165  const Array<OneD, const NekDouble> &inarray,
166  Array<OneD, NekDouble> &outarray, const StdRegions::StdMatrixKey &mkey);
167 
169  const unsigned int traceid, Array<OneD, unsigned int> &maparray);
170 
172  const unsigned int eid, Array<OneD, unsigned int> &maparray,
173  Array<OneD, int> &signarray, Orientation edgeOrient, int P, int Q);
174 
176  const int eid, Array<OneD, unsigned int> &maparray,
177  Array<OneD, int> &signarray, Orientation edgeOrient = eForwards,
178  int P = -1, int Q = -1);
179 
180  STD_REGIONS_EXPORT virtual void v_GenStdMatBwdDeriv(const int dir,
181  DNekMatSharedPtr &mat);
182 
183 private:
184  // Virtual Functions ----------------------------------------
185  virtual int v_GetShapeDimension() const
186  {
187  return 2;
188  }
189 
190  virtual int v_GetCoordim(void)
191  {
192  return 2;
193  }
194 };
195 
196 typedef std::shared_ptr<StdExpansion2D> StdExpansion2DSharedPtr;
197 
198 } // namespace StdRegions
199 } // namespace Nektar
200 
201 #endif // STDEXP2D_H
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
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
virtual void v_GetElmtTraceToTraceMap(const unsigned int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation edgeOrient, int P, int Q)
Determine the mapping to re-orientate the coefficients along the element trace (assumed to align with...
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.
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 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_GetTraceToElementMap(const int eid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation edgeOrient=eForwards, int P=-1, int Q=-1)
virtual int v_GetShapeDimension() const
NekDouble Integral(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &w0, const Array< OneD, const NekDouble > &w1)
virtual void v_GetTraceCoeffMap(const unsigned int traceid, Array< OneD, unsigned int > &maparray)
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_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
virtual void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
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)
virtual void v_GenStdMatBwdDeriv(const int dir, DNekMatSharedPtr &mat)
The base class for all shapes.
Definition: StdExpansion.h:71
std::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
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