Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Daughter of StdExpansion. This class contains routine
33 // which are common to 3D expansion. Typically this inolves physiocal
34 // space operations.
35 //
36 ///////////////////////////////////////////////////////////////////////////////
37 
38 #ifndef STDEXP3D_H
39 #define STDEXP3D_H
40 
43 
44 namespace Nektar
45 {
46  namespace StdRegions
47  {
48 
50  typedef boost::shared_ptr<StdExpansion3D> StdExpansion3DSharedPtr;
51 
52  class StdExpansion3D: virtual public StdExpansion
53  {
54 
55  public:
58  const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc);
59  STD_REGIONS_EXPORT StdExpansion3D(const StdExpansion3D &T);
61 
62  // Differentiation
63 
64  /** \brief Calculate the 3D derivative in the local
65  * tensor/collapsed coordinate at the physical points
66  *
67  * This function is independent of the expansion basis and can
68  * therefore be defined for all tensor product distribution of
69  * quadrature points in a generic manner. The key operations are:
70  *
71  * - \f$ \frac{d}{d\eta_1} \rightarrow {\bf D^T_0 u } \f$ \n
72  * - \f$ \frac{d}{d\eta_2} \rightarrow {\bf D_1 u } \f$
73  * - \f$ \frac{d}{d\eta_3} \rightarrow {\bf D_2 u } \f$
74  *
75  * \param inarray array of physical points to be differentiated
76  * \param outarray_d1 the resulting array of derivative in the
77  * \f$\eta_1\f$ direction will be stored in outarray_d1 as output
78  * of the function
79  * \param outarray_d2 the resulting array of derivative in the
80  * \f$\eta_2\f$ direction will be stored in outarray_d2 as output
81  * of the function
82  * \param outarray_d3 the resulting array of derivative in the
83  * \f$\eta_3\f$ direction will be stored in outarray_d3 as output
84  * of the function
85  *
86  * Recall that:
87  * \f$
88  * \hspace{1cm} \begin{array}{llll}
89  * \mbox{Shape} & \mbox{Cartesian coordinate range} &
90  * \mbox{Collapsed coord.} &
91  * \mbox{Collapsed coordinate definition}\\
92  * \mbox{Hexahedral} & -1 \leq \xi_1,\xi_2, \xi_3 \leq 1
93  * & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
94  * & \eta_1 = \xi_1, \eta_2 = \xi_2, \eta_3 = \xi_3 \\
95  * \mbox{Tetrahedral} & -1 \leq \xi_1,\xi_2,\xi_3; \xi_1+\xi_2 +\xi_3 \leq -1
96  * & -1 \leq \eta_1,\eta_2, \eta_3 \leq 1
97  * & \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 \\
98  * \end{array} \f$
99  */
100  STD_REGIONS_EXPORT void PhysTensorDeriv(const Array<OneD, const NekDouble> &inarray,
101  Array<OneD, NekDouble> &outarray_d1,
102  Array<OneD, NekDouble> &outarray_d2,
103  Array<OneD, NekDouble> &outarray_d3);
104 
106  const Array<OneD, const NekDouble>& base0,
107  const Array<OneD, const NekDouble>& base1,
108  const Array<OneD, const NekDouble>& base2,
109  const Array<OneD, const NekDouble>& inarray,
110  Array<OneD, NekDouble>& outarray,
111  Array<OneD, NekDouble>& wsp,
112  bool doCheckCollDir0,
113  bool doCheckCollDir1,
114  bool doCheckCollDir2);
115 
117  const Array<OneD, const NekDouble>& base0,
118  const Array<OneD, const NekDouble>& base1,
119  const Array<OneD, const NekDouble>& base2,
120  const Array<OneD, const NekDouble>& inarray,
121  Array<OneD, NekDouble> &outarray,
122  Array<OneD, NekDouble> &wsp,
123  bool doCheckCollDir0,
124  bool doCheckCollDir1,
125  bool doCheckCollDir2);
126 
127  protected:
128 
129  /** \brief This function evaluates the expansion at a single
130  * (arbitrary) point of the domain
131  *
132  *
133  * Based on the value of the expansion at the quadrature points,
134  * this function calculates the value of the expansion at an
135  * arbitrary single points (with coordinates \f$ \mathbf{x_c}\f$
136  * given by the pointer \a coords). This operation, equivalent to
137  * \f[ u(\mathbf{x_c}) = \sum_p \phi_p(\mathbf{x_c}) \hat{u}_p \f]
138  * is evaluated using Lagrangian interpolants through the quadrature
139  * points:
140  * \f[ u(\mathbf{x_c}) = \sum_p h_p(\mathbf{x_c}) u_p\f]
141  *
142  * This function requires that the physical value array
143  * \f$\mathbf{u}\f$ (implemented as the attribute #phys)
144  * is set.
145  *
146  * \param coords the coordinates of the single point
147  * \return returns the value of the expansion at the single point
148  */
150  const Array<OneD, const NekDouble>& coords,
151  const Array<OneD, const NekDouble>& physvals);
152 
153 
155  const Array<OneD, DNekMatSharedPtr >& I,
156  const Array<OneD, const NekDouble >& physvals);
157 
159  const Array<OneD, const NekDouble>& base0,
160  const Array<OneD, const NekDouble>& base1,
161  const Array<OneD, const NekDouble>& base2,
162  const Array<OneD, const NekDouble>& inarray,
163  Array<OneD, NekDouble>& outarray,
164  Array<OneD, NekDouble>& wsp,
165  bool doCheckCollDir0,
166  bool doCheckCollDir1,
167  bool doCheckCollDir2) = 0;
168 
170  const Array<OneD, const NekDouble>& base0,
171  const Array<OneD, const NekDouble>& base1,
172  const Array<OneD, const NekDouble>& base2,
173  const Array<OneD, const NekDouble>& inarray,
174  Array<OneD, NekDouble>& outarray,
175  Array<OneD, NekDouble>& wsp,
176  bool doCheckCollDir0,
177  bool doCheckCollDir1,
178  bool doCheckCollDir2) = 0;
179 
181  const Array<OneD, const NekDouble> &inarray,
182  Array<OneD,NekDouble> &outarray,
183  const StdRegions::StdMatrixKey &mkey);
184 
186  const Array<OneD, const NekDouble> &inarray,
187  Array<OneD,NekDouble> &outarray,
188  const StdRegions::StdMatrixKey &mkey);
189 
191  const Array<OneD, const NekDouble>& inarray);
192 
194  const int face);
195 
196  std::map<int, NormalVector> m_faceNormals;
197  std::map<int, bool> m_negatedNormals;
198 
199  private:
200 
201  virtual int v_GetShapeDimension() const
202  {
203  return 3;
204  }
205 
206  virtual int v_GetCoordim(void)
207  {
208  return 3;
209  }
210  STD_REGIONS_EXPORT const NormalVector & v_GetSurfaceNormal(const int id) const;
211  STD_REGIONS_EXPORT const NormalVector & v_GetFaceNormal(const int face) const;
212 
213  };
214 
216  const int facedir,
217  const LibUtilities::BasisType faceDirBasisType,
218  const int numpoints,
219  const int nummodes);
220 
222  const int facedir,
223  const LibUtilities::BasisType faceDirBasisType,
224  const int numpoints,
225  const int nummodes);
226  } //end of namespace
227 } //end of namespace
228 
229 #endif //STDEXP3D_H